module App::View
    class WatchdogObserver < Qt::Object
        slots 'old_task_detected(QObject*)'
        slots 'recent_task_detected(QObject*)'

        def initialize(watchdog)
            super()
            
            Qt::Object.connect(watchdog, SIGNAL('old_task_detected(QObject*)'),
                self, SLOT('old_task_detected(QObject*)'))
            Qt::Object.connect(watchdog, SIGNAL('recent_task_detected(QObject*)'),
                self, SLOT('recent_task_detected(QObject*)'))
        end

        def old_task_detected(task)
            task.setForeground(Qt::Brush.new(Qt::Color.new(Qt::gray)))
        end

        def recent_task_detected(task)
            task.setForeground(Qt::Brush.new(Qt::Color.new(Qt::white)))
        end
    end
end
